<script type="text/javascript">
jQuery(function($) {
	$('#datatable').dataTable({
		'bJQueryUI': true,
		'sPaginationType': 'full_numbers'
	});
	
	 if(jQuery("#nortify").css('display')!= 'none'){
        jQuery("#nortify").fadeOut(4000);
	 }
	 
});

jQuery(function($) {
	$("#btn_add_new_hotel").click(function(){
	   window.location.replace("/admin/hotel/edit/0");
	});
});

function delete_confirmation(hotel_id){
	var res=confirm("Are you sure you want to delete this hotel?"); 
	if(res==true){
		window.location.replace("/admin/hotel/delete/"+hotel_id);
	}
}
 
</script>

<section id="content">
	<section class="container_12 clearfix">
		<section id="main" class="grid_12">
			<article class="content">
				 <?
				if(isset($message_id)){
					switch($message_id){
						case true:{
							echo '<div id="nortify" style="display:block;" class="success msg">The hotel has been deleted successfully.</div>';
						}break;
						case false:{
							echo '<div id="nortify" style="display:block;" class="error msg">An error has occured while deleting.</div>';
						}break;
					}
				} 
			?>
			   
              <ul style="list-style:none;float:left;">
              	<li style="float:left;">
                	<h2>Hotel List</h2></li>
                <li style="float:left;">
                	<button id="btn_add_new_hotel" style="margin-left: 10px;margin-top: 20px;" type="button" class="button">Add New Hotel</button></li>
              </ul>
                <table id="table1" class="gtable sortable">
                    <thead>
                        <tr> 
                        <th>Hotel ID</th>
                        <th>Hotel Name</th>
                        <th>Category</th>
                        <th>City</th>
                        <th>Type</th>
                        <th>Star Rate</th>
                        <th>Status</th>
                        <th>Edit</th>
                        </tr>
                    </thead>
                    <tbody> 
                    <?
                    foreach($hotel_list as $hotel){?> 
                    <tr class="gradeA odd">
                        <td><?=$hotel->id?></td>
                        <td><?=$hotel->hotel_name?></td>
                        <td><?=$hotel->hotel_category_name?></td>
                        <td class="center"><?=$hotel->hotel_city_name?></td>
                        <td class="center"><?=$hotel->hotel_type_name?></td>
                        <td class="center"><img style="border:0px solid #DDDDDD;padding:0px;" src="/images/icons/star-<?=$hotel->star_rate?>.jpg" width="24" height="24" border="0" /></td>
                        <td class="center"><?
							switch($hotel->status_id){
								case 1:{echo 'New';}break;
								case 2:{echo 'Activated';}break;
								case 3:{echo 'Disabled';}break;
							}
						 ?></td>  
                            <td> 
                                <img class="move" src="/images/icons/arrow-move.png" alt="Move" title="Move" />
                                <a href="/admin/hotel/edit/<?=$hotel->id?>" title="Edit"><img src="/images/icons/edit.png" alt="Edit" /></a>
                                <a href="#" title="Delete"><img onclick="javascript:delete_confirmation('<?=$hotel->id?>');" src="/images/icons/cross.png" alt="Delete" /></a>
                            </td>
                        </tr>
                     <? } ?>
                    </tbody>
                </table>
			</article>
		</section>
	</section>
</section>
 